<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<style>
    #commentForm .main-container{padding-bottom: 50px!important;}
    .main-container{padding-top: 10px!important;}
    .add-tag{margin: 5px 0}
    .mainBox{bottom: 0!important;}
    .xuanmsg{color: #aaa;margin: 9px 0 5px 11px;font-size: 12px}
    .page-title{border-bottom: 10px solid #ecf0f1;}
    .bottss{width: 100%;height: 30px;position: fixed;bottom: 0;}

</style>
<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title">
        <div class="page-title-con"><span>评论</span><div class="move_title"></div><?php include "../public/sub.php";?></div>
    </div>
    <div class="main-container">
        <div class="block-generic">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>评论给</label>
                        <div class="layui-input-block">
                            <div id="domer"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">评论内容</label>
                        <div class="layui-input-block" style="position: relative">
                            <input type="text" name="explain" id="explain" placeholder="请输入" clearable  autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <?php include '../public/upinfotwo.php'?>

        </div>
    </div>
</form>
<div class="bottss"></div>
<script>
    var param_id = getQueryVariable('id') || 0;

    $("#commentForm").validate({
        rules: {
            explain: {required: true},
        },
        messages:{
            explain: {required: "请输入"},
        }
    });

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();
        facade.ajax({type: 'get', url: ask_flow_talk_bill, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {

                var domerXmObj = xmselect_duo('domer', res.data.domerArr, '', function (res) {
                    if(res.arr && res.arr.length > 0){
                        $("#domer").find('xm-select').removeClass('error');
                    }else{
                        $("#domer").find('xm-select').addClass('error');
                    }
                });

                public_upload_file_load('upload_files');
                render_from();
            }
        });


        form.on('submit(add)', function(data){
            var validRes = $("#commentForm").valid();
            if(!data.field.domer){
                $("#domer").find('xm-select').addClass('error');
                validRes = false;
            }else{
                $("#domer").find('xm-select').removeClass('error');
            }
            if(!validRes){return false;}


            data.field.id = param_id;
            data.field.files = public_upload_file_value_str('upload_files');

            facade.ajax({url: ask_flow_talk_bill, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    facade.success('操作成功');
                    setTimeout(function () {
                        parent.window.location.reload();
                    },1500);
                }
            });

            return false;
        });
    });



</script>
</body>
</html>
